package com.ynet.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.lang.RuntimeException;

/**
 * 平台自定义异常
 * 
 * @author liuxin
 *
 */
public class FinMallException extends RuntimeException {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	private static Logger logger = LoggerFactory.getLogger(FinMallException.class);

	/**
	 * 错误代码
	 */
	private String returnCode;

	/**
	 * 错误信息
	 */
	private String returnMsg;

	public FinMallException() {
		this.returnCode = ParamConstants.UNKNOWNCODE;
		this.returnMsg = ParamConstants.UNKNOWNMSG;
		logger.debug("错误代码： returnCode " + returnCode + " 错误信息：returnMsg" + returnMsg);
	}

	/**
	 * 
	 */
	public FinMallException(String returnCode) {
		String returnMsg = MessageStaticUtils.getMessage(returnCode);
		this.returnCode = returnCode;
		this.returnMsg = returnMsg;
		logger.debug("错误代码： returnCode " + returnCode + " 错误信息：returnMsg " + returnMsg);
	}

	/**
	 * 
	 */
	public FinMallException(String returnCode, String returnMsg) {

		logger.debug("错误代码：  " + returnCode + " 错误信息：" + returnMsg);

		this.returnCode = returnCode;
		this.returnMsg = returnMsg;
	}

	public String getReturnCode() {
		return returnCode;
	}

	public void setReturnCode(String returnCode) {
		this.returnCode = returnCode;
	}

	public Object getReturnMsg() {
		return returnMsg;
	}

	public void setReturnMsg(String returnMsg) {
		this.returnMsg = returnMsg;
	}

}
